home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
cug106
/
xtrinslb.mac
< prev
next >
Wrap
Text File
|
1984-06-14
|
3KB
|
153 lines
title Xtract field from and insert field into buffer
name ('XTRINS')
;
; This is intended for use with Microsoft 'M80' and 'L80'
;
.xlist ; turn off listing
.xcref ; turn off cross reference label 'reference' accumulation
;
;
@CHK macro ?DD ;; Used for checking range of 8-bit displacements
if (?DD gt 7FH) and (?DD lt 0FF80H)
'Displacement Range Error - TDL LIB' ;;force an error
endif
endm
;
LDED macro ?NNNN
db 0EDH,5BH
dw ?NNNN
endm
;
LBCD macro ?NNNN
db 0EDH,4BH
dw ?NNNN
endm
;
;
BIT macro ?N,?R
db 0CBH,?N*8+?R+40H
endm
;
SETB macro ?N,?R
db 0CBH,?N*8+?R+0C0H
endm
;
RES macro ?N,?R
db 0CBH,?N*8+?R+80H
endm
;
;
JMPR macro ?N
db 18H,?N-$-1
endm
;
JRC macro ?N
db 38H,?N-$-1
endm
;
JRNC macro ?N
db 30H,?N-$-1
endm
;
JRZ macro ?N
db 28H,?N-$-1
endm
;
JRNZ macro ?N
db 20H,?N-$-1
endm
;
DJNZ macro ?N
db 10H,?N-$-1
endm
;
;
RLCR macro ?R
db 0CBH, 00H + ?R
endm
;
RALR macro ?R
db 0CBH, 10H+?R
endm
;
RRCR macro ?R
db 0CBH, 08H + ?R
endm
;
RARR macro ?R
db 0CBH, 18H + ?R
endm
;
SLAR macro ?R
db 0CBH, 20H + ?R
endm
;
SRAR macro ?R
db 0CBH, 28H+?R
endm
;
SRLR macro ?R
db 0CBH, 38H + ?R
endm
;
;
;
.cref ; re-enable cross reference
.list ; re-enable listing
;
;
;++ **************************************************
;
; TO USE THIS ROUTINE:
;
; M80 XTRINSLB=XTRINSLB ...Microsoft 'M80'
; L80 XTRINSLB,XTRINSLB/N/E ...Microsoft 'L80'
; REN BIOS.CRL=BIOS.COM
;
; XTRINSLB.CRL WILL BE A 'C' COMPATIBLE RELOCATABLE FILE
; WHICH CAN BE REQUESTED AT CLINK OR INTEGRATED
; INTO YOUR LIBRARY WITH CLIB
;
;-- **************************************************
;
MAGIC equ 3F7H ;'C' PARAMETER PASSING BUFFER
;
aseg
org 100H
.phase 0
;
ZERO: dc 'INSERT' ; Name of insert function
dw INSHEAD ; Location of insert function
dc 'XTRACT' ; Name of xtract function
dw XTRHEAD ; Location of xtract function
;
db 80H ;END OF DIRECTORY ENTRIES
dw FINIS - 100H ;POINTER TO NEXT AVAIL LOCATION IN FILE
ds (512 -($-ZERO)) ;PAD REST OF DIRECTORY
ds 5 ;RESERVED FOR 'CLIB'
;
.dephase
;
page
;
;++ ****************************************
;
;$$ INSERT -- Insert bit field into a byte array
;
; Bits are numbered 1..N
; Width may be 1..16
;
; Storage format is:
;
; msb lsb
;
; 8 1 first byte of array
; 16 9
; . .
; . .
; N N-8 last byte of array
;
; insert(array,data,start,width)
; char *array;
; unsigned data;
; char